// routes/cards/findAllByGroup.js
const express = require('express');
const pool = require('../../config/pool'); // 使用连接池
const router = express.Router();
const isAdmin = require('../../middleware/isAdmin');

router.get('/', isAdmin, (req, res) => {
    const query = `SELECT * FROM card_types`;
    pool.query(query, (err, results) => {
        if (err) {
            return res.json({
                code: 0,
                message: '数据库错误',
                success: false
            });
        }
        res.json({
            code: 1,
            message: '获取卡片类型成功',
            success: true,
            data: results
        });
    });
});

module.exports = router;